import { Big } from "../core/Big";
import { Player } from "../core/Player";
import { Terrain } from "../core/Point";
import Utils from "../GameUtils";

export class 天谕 extends Big {

    is_smelling = false     //明魂搜根
    smell_to_player = null  //你在搜谁
    is_looking = false      //天眼传真
  
    smell(player: Player) {
        this.is_smelling = true
        this.smell_to_player = player
        this.stateUpdate()
    }

    look() {
        this.is_looking = true
        this.stateUpdate()
    }

    turnOver(): void {
        super.turnOver();
        this.is_smelling = false
        this.smell_to_player = null
        this.is_looking = false
        this.stateUpdate()
    }

    /**
     * 技能状态变化
     */
    stateUpdate() {
        this.gameMgr.sendBroadcast(Utils.getObj("天谕_update",{
            "point_id":this.point.id,
            "is_smelling":this.is_smelling,
            "username":this.smell_to_player?this.smell_to_player.username:null,
            "is_looking":this.is_looking
        },true,false),false)
    }

    terrainAdapt() {
        switch (this.point.terrain) {
            case Terrain.SHAN:
            case Terrain.SHUI:
                this.die(this.player)
        }
    }
}